<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>菜单修改</title>
    <th:block th:include="~{common/common::commonHead}"/>
</head>
<body data-width="400" data-height="500">
<div class="container-fluid">
    <form class="form-horizontal" role="form" th:action="@{/system/editMenu}">
        <input type="hidden" id="id" name="id">
        <div class="form-group">
            <label class="col-xs-4 control-label text-right"> 菜单编号：</label>
            <div class="col-xs-8">
                <div class="iconic-input right">
                    <input id="menuId" name="menuId" type="text" class="form-control spinner" required placeholder="6位数字">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 菜单名称：</label>
            <div class="col-xs-8">
                <div class="iconic-input right">
                    <input id="menuName" name="menuName" type="text" class="form-control spinner" required placeholder="1~20位字符">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 上级菜单：</label>
            <div class="col-xs-8">
                <select id="parentId" name="parentId" class="form-control spinner" data-url="system/listMenu"
                        data-value-field="menuId" data-text-field="menuName">
                    <option value="0">顶级</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 菜单图标：</label>
            <div class="col-xs-8">
                <div class="iconic-input right">
                    <input id="menuIcon" name="menuIcon" type="text" class="form-control spinner" placeholder="1~60位字符">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 菜单链接：</label>
            <div class="col-xs-8">
                <div class="iconic-input right">
                    <input id="menuLink" name="menuLink" type="text" class="form-control spinner" placeholder="1~255位url">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 菜单排序：</label>
            <div class="col-xs-8">
                <div class="iconic-input right">
                    <input id="menuSort" name="menuSort" type="number" class="form-control spinner" placeholder="请输入菜单排序号" required>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 菜单状态：</label>
            <div class="col-xs-8">
                <select name="menuStatus" id="menuStatus" class="form-control">
                    <option value="">请选择菜单状态</option>
                    <option value="0">隐藏</option>
                    <option value="1">显示</option>
                </select>
            </div>
        </div>
    </form>
</div>
</body>
</html>
<script>
    $(function () {
        var params = $.getUrlParams();
        $.doAjax("system/getMenu", {id: params['id']}, function (menu) {
            $("#id").val(menu['id']);
            $("#menuId").val(menu['menuId']);
            $("#menuName").val(menu['menuName']);
            $("#parentId").val(menu['parentId']).attr("data-value", menu['parentId']);
            $("#menuLevel").val(menu['menuLevel']);
            $("#menuIcon").val(menu['menuIcon']);
            $("#menuLink").val(menu['menuLink']);
            $("#menuStatus").val(menu['menuStatus']);
            $("#menuSort").val(menu['menuSort']);
        });

    });
</script>